home *** CD-ROM | disk | FTP | other *** search
/ .net 2000 December / Net78.iso / pc / Software / AceHTML 4.0 / AceHTML4Pro.exe / %MAINDIR% / ScriptDef / Rainbow Text.sd < prev    next >
Encoding:
INI File  |  2000-08-31  |  1.6 KB  |  89 lines

  1. [SUBJECT]
  2. Description=Displays your text in a multitude of rainbow colors
  3. ImageIndex=-1
  4. Folder=Quick JavaScript
  5.  
  6.  
  7.  
  8. [HEAD_TEXT]
  9. ;<SCRIPT LANGUAGE="JavaScript">
  10. ;<!-- Begin
  11. ;function createHexArray(n) {
  12. ;this.length = n;
  13. ;for (var i = 1; i <= n; i++)
  14. ;this[i] = i - 1;
  15. ;
  16. ;this[11] = "A";
  17. ;this[12] = "B";
  18. ;this[13] = "C";
  19. ;this[14] = "D";
  20. ;this[15] = "E";
  21. ;this[16] = "F";
  22. ;return this;
  23. ;}
  24. ;hx = new createHexArray(16);
  25. ;
  26. ;function convertToHex(x) {
  27. ;if (x < 17) x = 16;
  28. ;var high = x / 16;
  29. ;var s = high+"";
  30. ;s = s.substring(0, 2);
  31. ;high = parseInt(s, 10);
  32. ;var left = hx[high + 1];
  33. ;var low = x - high * 16;
  34. ;if (low < 1) low = 1;
  35. ;s = low + "";
  36. ;s = s.substring(0, 2);
  37. ;low = parseInt(s, 10);
  38. ;var right = hx[low + 1];
  39. ;var string = left + "" + right;
  40. ;return string;
  41. ;}
  42. ;
  43. ;function makeRainbow(text) {
  44. ;text = text.substring(0, text.length);
  45. ;color_d1 = 255;
  46. ;mul = color_d1 / text.length;
  47. ;for(var i = 0; i < text.length; i++) {
  48. ;color_d1 = 255*Math.sin(i / (text.length / 3));
  49. ;color_h1 = convertToHex(color_d1);
  50. ;color_d2 = mul * i;
  51. ;color_h2 = convertToHex(color_d2);
  52. ;
  53. ;k = text.length;
  54. ;j = k - i;
  55. ;if (j < 0) j = 0;
  56. ;color_d3 = mul * j;
  57. ;color_h3 = convertToHex(color_d3);
  58. ;
  59. ;document.write("<FONT COLOR=\"#" + color_h3 + color_h1 + color_h2 + "\">" + text.substring(i, i + 1) + "</FONT>");
  60. ;   }
  61. ;}
  62. ;// End -->
  63. ;</script>
  64. ;
  65.  
  66.  
  67. [BODY_TEXT]
  68. ;<center>
  69. ;<strong>
  70. ;<font size=6>
  71. ;<script>
  72. ;<!--
  73. ;makeRainbow("`text`");
  74. ;// -->
  75. ;</script>
  76. ;</font>
  77. ;</strong>
  78. ;</center>
  79. ;
  80.  
  81.  
  82.  
  83.  
  84. [`text`]
  85. Kind=S
  86. Value=Welcome to The JavaScript Source!
  87.  
  88.  
  89.